class CollegeController < ApplicationController

  def add
    @college = College.new
  end

  def create
    #create our college
     @college = College.new(params[:college])
   
    if @college.save #== @user
      flash[:notice] = 'The College has been added'
      redirect_to :controller => "college", :action => "index"
    else
      flash[:notice] = 'Problem detected'
      render :action => "add"
    end
  end

  def edit
    @college = College.find(params[:id])
  end

  def update
    @college = College.find(params[:id])
    
    if @college.update_attributes(params[:college])
      flash[:notice] = 'Updated'
      redirect_to :action => "index"
    else
      render :action => "edit"
    end
  end

  def index
    @colleges = College.find :all
  end

  def delete
  end

  def destroy
    if  College.destroy(params[:id])
      flash[:notice] = 'Deleted'
      redirect_to :action => "index"
    else
      render :action => "edit"
    end
  end
end